package com.njym.swagger2;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2
public class Swagger2 {
	@Bean
	public Docket AliPayApi() {
		return new Docket(DocumentationType.SWAGGER_2)
		        .groupName("支付宝API接口文档")
		        .apiInfo(apiInfo())
				.select()
				.apis(RequestHandlerSelectors.basePackage("com.njym.payment.alipay"))
				.paths(PathSelectors.any()).build();
	}
	@Bean
	public Docket WeiXinPayApi() {
		return new Docket(DocumentationType.SWAGGER_2)
		        .groupName("微信API接口文档")
		        .apiInfo(apiInfo())
				.select()
				.apis(RequestHandlerSelectors.basePackage("com.njym.payment.wxpay"))
				.paths(PathSelectors.any()).build();
	}
//	@Bean
//	public Docket unionpayApi() {
//		return new Docket(DocumentationType.SWAGGER_2)
//		        .groupName("银联API接口文档")
//		        .apiInfo(apiInfo())
//				.select()
//				.apis(RequestHandlerSelectors.basePackage("com.itstyle.modules.unionpay"))
//				.paths(PathSelectors.any()).build();
//	}
	private ApiInfo apiInfo() {
		return new ApiInfoBuilder()
				.title("南京云麦综合支付平台")
				.description("支付宝、微信、银联等支付服务")
//				.termsOfServiceUrl("www.icloudmedi.com")
				.version("V1.0")
				.contact(new Contact("南京云麦 ", "http://www.icloudmedi.com", "719026580@qq.com"))
				.build();
	}

}